package com.example.fittrack.controller;

import cn.hutool.core.util.IdUtil;
import com.example.fittrack.R.R;
import com.example.fittrack.domain.bo.BasicInfoBo;
import com.example.fittrack.domain.bo.IdBo;
import com.example.fittrack.domain.bo.QueryBasicInfoBo;
import com.example.fittrack.service.ArchiveService;
import com.example.fittrack.utils.DateUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RequestMapping("/archive")
@RestController
public class ArchiveController {

    private final ArchiveService archiveService;


    @PostMapping("/add")
    public R add(@Validated @RequestBody BasicInfoBo bo){
        return archiveService.add(bo);
    }

    @PostMapping("/list")
    public R list(@RequestBody QueryBasicInfoBo bo){
        return archiveService.list(bo);
    }

    @PostMapping("/dele")
    public R list(@RequestBody IdBo bo){
        return archiveService.delete(bo.getId());
    }


}
